package space.sakana.edusysback.mapper.paper;

import org.apache.ibatis.annotations.*;
import space.sakana.edusysback.entity.paper.Paper;

import java.util.List;

@Mapper
public interface PaperMapper {

    @Select("select `id`, `name`, `tid`, `create`, `score` from paper where `id`=#{id};")
    Paper selectPaperById(int id);

    @Select("select `id`, `name`, `tid`, `create`, `score` from paper;")
    List<Paper> selectAllPaper();

    @Insert("insert into paper(`name`, `tid`, `create`, `score`) values(#{name},  #{tid}, #{create}, #{score});")
    int insertPaper(Paper paper);

    @Update("update paper set `name`=#{name}, `tid`=#{tid}, `create`=#{create}, `score`=#{score} where `id`=#{id};")
    int updatePaper(Paper paper);

    @Delete("delete from paper where `id`=#{pid}")
    int deletePaperById(int pid);
}
